import type { ApiResponse, BaseRecordSearchWrapper, BaseRecordVo, TableQuery } from '@/types/basetypes';
import type { ExaminaionPaperQuestionForm } from '@/types/examinaion/types';
import type { TableConfigrationType } from '@/types/table-configtypes';
import type { QueryWrapper, UpdateWrapper } from '@/types/wrappertypes';
import request from '@/utils/request'

// 查询试卷题目列表信息
export function _getExaminaionPaperQuestionList(params: object) {
  return request({
    url: '/examinaion-paper-question/query-all',
    method: 'GET',
    params: params,
  });
}

// 查询试卷题目信息
export const _getExaminaionPaperQuestionInfo = async (params: { id: string }): Promise<ApiResponse<ExaminaionPaperQuestionForm>> => {
  const { id } = params;
  return request({
    url: `/examinaion-paper-question/query-details/${id}`,
    method: 'GET',
  });
}

// 查询试卷题目信息s
export const _getExaminaionPaperQuestionInfos = async (params: { id: string }): Promise<ApiResponse<ExaminaionPaperQuestionForm[]>> => {
  const { id } = params;
  return request({
    url: `/examinaion-paper-question/query-details-cust/${id}`,
    method: 'GET',
  });
}

// 保存试卷题目信息
export const _saveExaminaionPaperQuestionInfo = async (params: object): Promise<ApiResponse<void>> => {
  return request({
    url: '/examinaion-paper-question/insert',
    method: 'POST',
    data: params,
  });
}

// 更新试卷题目信息
export const _modifyExaminaionPaperQuestionInfo = async (params: UpdateWrapper): Promise<ApiResponse<void>> => {
  return request({
    url: '/examinaion-paper-question/modify',
    method: 'POST',
    data: params,
  });
}

// 删除试卷题目信息
export const _delExaminaionPaperQuestionInfoByIds = async (ids: string): Promise<ApiResponse<void>> => {
  return request({
    url: '/examinaion-paper-question/del-ids',
    method: 'POST',
    data: { ids: ids },
  });
}

// 查询试卷题目操作记录
export const _getExaminaionPaperQuestionRecordInfos = async (params: { id: string }): Promise<ApiResponse<BaseRecordVo[]>> => {
  const { id } = params;
  return request({
    url: `/examinaion-paper-question/query-details-record/${id}`,
    method: 'GET',
  });
}

// 新增备注
export const _saveExaminaionPaperQuestionRecordRemarkInfos = async (params: { bizId: string, remark: string }): Promise<ApiResponse<void>> => {
  return request({
    url: '/examinaion-paper-question/insert-remark',
    method: 'POST',
    data: params,
  });
}

// 搜索操作记录
export const _searchExaminaionPaperQuestionRecordRemarkInfos = async (params: BaseRecordSearchWrapper): Promise<ApiResponse<BaseRecordVo[]>> => {
  return request({
    url: '/examinaion-paper-question/query-details-record-wrapper',
    method: 'POST',
    data: params,
  });
}

// 查询试卷题目表格配置数据
export const _getExaminaionPaperQuestionTableConfigeration = async (): Promise<ApiResponse<TableConfigrationType>> => {
  return request({
    url: `/examinaion-paper-question/query-table-config`,
    method: 'GET',
  });
}

// 查询试卷题目表格列表数据
export const _getExaminaionPaperQuestionTableList = async (params: QueryWrapper): Promise<ApiResponse<TableQuery<ExaminaionPaperQuestionForm>>> => {
  return request({
    url: `/examinaion-paper-question/query-table-list`,
    method: 'POST',
    data: params
  });
}